<template>
	<view class="p20">
		<view class="bg-fff radius12 pl20 pr20">
			<view class="flex pt32 pb32 border-b" >
				<view class="color-666 mr20">陪诊项目</view>
				<input :value="servicesName" class="tr flex1" placeholder="请选择陪诊项目" />
				<u-icon name="arrow-right" class="ml10 pe-none" />
			</view>
			<view class="flex pt32 pb32 border-b" >
				<view class="color-666 ">陪诊医院</view>
				<input class="tr flex1 pe-none" value="郑州大学第一附属医院" />
				<u-icon name="arrow-right" class="ml10 pe-none" />
			</view>
			<view class="flex pt32 pb32 border-b">
				<view class="color-666 flex1">报价价格</view>
				<view class="bg-f8f w200 h64 flex">
					<input class="tc flex1" v-model="form.minimum_price" type="number" placeholder="最低报价" />
				</view>
				<view class="pl28 pr28">-</view>
				<view class="bg-f8f w200 h64 flex">
					<input class="tc flex1" v-model="form.highest_price" type="number" placeholder="最高报价" />
				</view>
			</view>
			<view class="flex pt32 pb32 border-b">
				<view class="color-666 flex1">
					<text>一口价价格</text>
				</view>
				<input class="tr flex1" v-model="form.price" placeholder="请输入一口价价格" type="number" />
			</view>
			<view class="flex pt32 pb32 border-b">
				<view class="color-666 flex1">
					<text class="color-red">*</text>
					<text>平台建议价：</text>
					<text class="color-red">￥{{suggested_price||'0.00'}}</text>
				</view>
			</view>
			<view class="flex pt32 pb32 border-b">
				<view class="color-666 flex1">
					<text>是否接受一口价最低金额</text>
				</view>
				<switch class="scale7" :checked="!!form.is_accept" @change="e=>form.is_accept=Number(e.detail.value)"
					:color="$zs" />
			</view>
			<view class="flex pt32 pb32 border-b" v-if="form.is_accept==1">
				<view class="color-666 flex1">
					<text>一口价最低价</text>
				</view>
				<input class="tr flex1" v-model="form.floor_price" placeholder="请输入一口价最低价" />
			</view>
		</view>
		<view class="h120"></view>
		<view class="pf bottom0 left0 bg-fff w-max">
			<view class="p20">
				<u-button type="warning" ripple @click="submit">确认</u-button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					services: '', //	数组	必填	-	-	医院项目数组：[['hospital_id':'1','service_id':[1,2,3],['hospital_id':'2','service_id':[1,2,3]]]]
					// hospital_ids:"",// 数组 必填 - -医院id数组
					// service_ids:"",// 数组 必填 - -服务id数组
					minimum_price: "", // 整型 必填 - -最低报价
					highest_price: "", // 整型 必填 - -最高报价
					price: "", // 整型 必填 - -一口价
					is_accept: "", // 整型 必填 - -是否接受： 0 不接受， 1 接受
					floor_price: "", // 整型 必填 - -一口价最低价
				},
				servicesName: '',
				suggested_price:''
			};
		},
		methods: {
			submit() {
				this.$request("/master/my/serviceAdd", this.form).then(res => {
					this.$msg(res.msg)
					setTimeout(this.$navBack, 1000)
				})
			},
			getSuggestedPrice() { //获取服务建议价
				this.$request("/master/commom/getSuggestedPrice", this.form).then(res => {
					this.suggested_price=res.data.suggested_price
				})
			},
			getHospital() {
				uni.$off('setDome')
				uni.$off('setDomeName')
				uni.$once('setDome', e => {
					this.form.services = e
					this.getSuggestedPrice()
				})
				uni.$once('setDomeName', e => this.servicesName = e)
				this.$u.route('/pages/my/serve/hospitalSel', {
					services: this.form.services && JSON.stringify(this.form.services) || ""
				})
			},

		}
	}
</script>

<style lang="scss">

</style>
